package 集合.双列.Map.TreeMap;

import java.util.TreeMap;

public class 统计字符串 {
    public static void main(String[] args) {
        String s="aacnakca";
        TreeMap<Character,Integer> tm=new TreeMap<>();

        for (int i = 0; i < s.length(); i++) {
            char c=s.charAt(i);
            System.out.println(c);
            if(tm.containsKey(c)){
            int count=tm.get(c);
            count++;
            tm.put(c,count);
            }
            else {
                tm.put(c,1);
            }
        }
        //最后遍历


    }
}
